<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>教师管理</title>
<script type="text/javascript">
	function del(id) {
		if(confirm("是否删除这条记录！")){
			$('#work').load('teacher',{method:'delete',id:id});
		}
	}
	
	function add(){
		$('#work').empty();
		$('#work').load('teacher',{method:'add'});
	}
	
	function update1(bjId){
		$('#work').empty();
		$('#work').load('teacher',{method:'update',id:bjId});
	}
	
	function fh(){
		window.location="course?method=fh";
	}
</script>
<style type="text/css">
		
		body{
		width:auto;
		height: auto;
		background-repeat:no-repeat;
		background-size: 100%;
		}
		
	.abc{
		width: 1400px;
		margin: 20px auto;
		border-radius:15px;
		padding-bottom: 50px;
		padding-left: 10px;
		padding-right: 10px;
	}
	
	table{
		width:100%;
		border-radius:6px;
	}
	
	td,th{
		
		padding: 7px 7px;
	
	}
	
	table{
			width:100%;
            border-collapse: collapse;
            margin: 0 auto;
            text-align: center;
    }
    table td, table th{
            border: 1px solid #cad9ea;
            color: #666;
            height: 30px;
            min-width: 200px;
    }
    table thead th{
            background-color: #CCE8EB;
            width: 100px;
    }
    table tr:nth-child(odd){
            background: #fff;
   	}
    
    table tr:nth-child(even){
            background: #F5FAFA;
    }
	
	button{
		padding: 5px 10px;
		margin-bottom: 5px
	}
	
	h3{
		text-align:center; 
	}
</style>
</head>
<body>
<div class="abc">
	<h3>教师管理</h3>
	<button onclick="add()">新增</button>
	<table border="1" style="min-width: 350px;text-align: center;vertical-align:middle">
	<thead>
		<tr>
			<th>序号</th>
			<th>教师姓名</th>
			<th>教师账号</th>
			<th colspan="2">操作</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${list}" var="bj">
		<tr>
			<td>${bj.id}</td>
			<td>${bj.name}</td>
			<td>${bj.username}</td>
			<td><a href="javaScript:update1(${bj.id})">修改</a></td>
			<td><a href="javaScript:del(${bj.id})">删除</a></td>
		</tr>
	</c:forEach>
	</tbody>
	</table>
	<button onclick="fh()" style="margin-top: 5px;float: right;">返回</button>
</div>	
</body>
</html>